Include C89 fallback code
authorChun-wei Fan <fanchunwei@src.gnome.org>
Fri, 19 Aug 2011 06:26:52 +0000 (14:26 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Sat, 20 Aug 2011 03:17:44 +0000 (11:17 +0800)
gtk/gtkborderimage.c, gtk/gtklabel.c and gtk/gtkstyleproperty.c call
round() and/or rint(), which was only available in C99 compilers.

This adds the inclusion of the fallback implementation (gtk/fallback-c89.c)
to define these functions if they are not initially made available by the
compiler.

Also remove the rint() implementation in gtk/gtklabel.c as it is now in
the fallback implmentation.

gtk/gtkborderimage.c
gtk/gtklabel.c
gtk/gtkstyleproperty.c

index 4f6ded6aa1a62c2aba75d9183670a3109b4d2392..d5510ab5d7f5d725a4f2f405ca56360b82c0c28d 100644 (file)
 
 #include "gtkborderimageprivate.h"
 
+/* this is in case round() is not provided by the compiler, 
+ * such as in the case of C89 compilers, like MSVC
+ */
+#include "fallback-c89.c"
+
 G_DEFINE_BOXED_TYPE (GtkBorderImage, _gtk_border_image,
                      _gtk_border_image_ref, _gtk_border_image_unref)
 
index 6a6f72cf0aea2ef3487cdba89bf4b985fc9f8685..9fadbfd2d2825bd8dba6226b497af42f0b353ca9 100644 (file)
 
 #include "a11y/gtklabelaccessible.h"
 
+/* this is in case rint() is not provided by the compiler, 
+ * such as in the case of C89 compilers, like MSVC
+ */
+#include "fallback-c89.c"
+
 /**
  * SECTION:gtklabel
  * @Short_description: A widget that displays a small to medium amount of text
  * </refsect2>
  */
 
-
-/*rint() is only available in GCC and/or C99*/
-#if (__STDC_VERSION__ < 199901L && !defined __GNUC__)
-double rint(double x)
-{
-       if (ceil(x+0.5) == floor(x+0.5))
-       {
-               int a = (int)ceil(x);
-               if (a%2 == 0)
-                       return ceil(x);
-               else
-                       return floor(x);
-       }
-       else
-               return floor(x+0.5);
-}
-#endif
-
-
-
 struct _GtkLabelPrivate
 {
   GtkLabelSelectionInfo *select_info;
index 73200dc3e44859182173b515d2e310dd1e0d23ae..69f2e8ec4ac073211bc212987cb43f44ee9c4e33 100644 (file)
 #include "gtkthemingengine.h"
 #include "gtktypebuiltins.h"
 
+/* this is in case round() is not provided by the compiler, 
+ * such as in the case of C89 compilers, like MSVC
+ */
+#include "fallback-c89.c"
+
 static GHashTable *parse_funcs = NULL;
 static GHashTable *print_funcs = NULL;
 static GHashTable *properties = NULL;